package com.goverse.mancraft.world;

import com.goverse.mancraft.man.Man;
import com.goverse.mancraft.man.ManController;

/**
 * Created by gaoyu on 2017/4/15.
 */

public class WorldManager implements WorldTimer.OnDayModeChangeListener {

    private ManController mManController;

    public void start(WorldConfig worldConfig) {

        mManController = new ManController();
        mManController.addMan(new Man("张三"));
        WorldTimer.getInstance().addOnTimePassListener(mManController);
        WorldTimer.getInstance().setOnDayModeChangeListener(this);
        WorldTimer.getInstance().start(worldConfig.getCurrTime());

    }

    @Override
    public void onDayModeChanged(WorldTimer.DayMode dayMode) {
        if (dayMode == WorldTimer.DayMode.DAY) {

        } else if (dayMode == WorldTimer.DayMode.NIGHT) {

            mManController.goSleep();
        }
    }
}
